# cmake最低版本要求
cmake_minimum_required(VERSION 3.7)

# 设置工程的名字compiler
project(compiler)
set(SRC "source")
set(CMAKE_C_STANDARD 11)

add_compile_options(-g)
add_compile_options(-fpermissive)
add_compile_options(-DCMAKE_EXPORT_COMPILE_COMMANDS=YES)
add_compile_options(-DDEBUG_SHOW)

# 生成compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS on)
# 头文件搜索路径
include_directories(
    ${PROJECT_SOURCE_DIR}
    ${PROJECT_SOURCE_DIR}/${SRC}
    ${PROJECT_SOURCE_DIR}/${SRC}/tools
    ${PROJECT_SOURCE_DIR}/${SRC}/tools/comm
    ${PROJECT_SOURCE_DIR}/${SRC}/tools/nfa
    ${PROJECT_SOURCE_DIR}/${SRC}/tools/dfa
    ${PROJECT_SOURCE_DIR}/${SRC}/tools/reg
    ${PROJECT_SOURCE_DIR}/${SRC}/tools/macro
    ${PROJECT_SOURCE_DIR}/${SRC}/tools/input
)

# 搜索source下面的所有源文件，生成文件列表
file(GLOB_RECURSE SOURCE_LIST "${SRC}/*.cc" "${SRC}/tools/*.hpp")

# 将源文件列表加入到工程中
add_executable(${PROJECT_NAME} ${SOURCE_LIST})

